package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"gorm.io/gorm"
	"io/ioutil"
	"iot-base/common/common"
	"iot-base/common/dbconn"
	"iot-base/common/dbobj"
	"strings"
)

func main() {
	db, _ := dbconn.ConnectDB()
	result, err := common.GetGaudMapCode("29099d583b84fd176c7b56f5d84f7772", "中国", "1")
	if err != nil {
		fmt.Println("获取数据失败")
		return
	}
	districts := result["districts"].([]interface{})
	recursionAddAreas(db, districts)
	// 根据省获取
	info := districts[0].(map[string]interface{})
	for _, value := range info["districts"].([]interface{}) {
		temp := value.(map[string]interface{})
		province, err := common.GetGaudMapCode("29099d583b84fd176c7b56f5d84f7772", temp["name"].(string), "3")
		if err != nil {
			continue
		}
		districts = province["districts"].([]interface{})
		recursionAddAreas(db, districts)
	}

}

func AddArea() {
	//reqValue := &url.Values{}
	//reqValue.Set("key", "29099d583b84fd176c7b56f5d84f7772")
	//reqValue.Set("keywords", "中国")
	//reqValue.Set("subdistrict", "1")
	//reqUrl := "https://restapi.amap.com/v3/config/district" + "?" + reqValue.Encode()
	//b, err := common.HttpGet(reqUrl)
	//if err != nil {
	//	return
	//}
	db, _ := dbconn.ConnectDB()
	b, err := ioutil.ReadAll(strings.NewReader("{\"status\":\"1\",\"info\":\"OK\",\"infocode\":\"10000\",\"count\":\"1\",\"suggestion\":{\"keywords\":[],\"cities\":[]},\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310000\",\"name\":\"上海市\",\"center\":\"121.472644,31.231706\",\"level\":\"province\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310100\",\"name\":\"上海城区\",\"center\":\"121.472644,31.231706\",\"level\":\"city\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"浦东新区\",\"center\":\"121.567706,31.245944\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"航头镇\",\"center\":\"121.558,31.0727\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"洋泾街道\",\"center\":\"121.548,31.2538\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"花木街道\",\"center\":\"121.579,31.2399\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"北蔡镇\",\"center\":\"121.521,31.1677\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"高行镇\",\"center\":\"121.592,31.3311\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"潍坊新村街道\",\"center\":\"121.525,31.2299\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"惠南镇\",\"center\":\"121.853,30.9913\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"康桥镇\",\"center\":\"121.601,31.1551\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"宣桥镇\",\"center\":\"121.707,31.0868\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"高东镇\",\"center\":\"121.677,31.3094\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"金桥镇\",\"center\":\"121.629,31.2812\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"祝桥镇\",\"center\":\"121.919,31.1943\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"大团镇\",\"center\":\"121.722,31.0057\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"新场镇\",\"center\":\"121.638,31.0855\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"沪东新村街道\",\"center\":\"121.574,31.2873\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"张江镇\",\"center\":\"121.592,31.2027\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"周浦镇\",\"center\":\"121.649,31.1291\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"张江高科技园区\",\"center\":\"121.638,31.2162\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"万祥镇\",\"center\":\"121.862,30.9722\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"周家渡街道\",\"center\":\"121.507,31.1678\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"南码头路街道\",\"center\":\"121.502,31.1956\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"川沙新镇\",\"center\":\"121.74,31.1939\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"东明路街道\",\"center\":\"121.489,31.143\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"曹路镇\",\"center\":\"121.656,31.2937\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"泥城镇\",\"center\":\"121.796,30.9489\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"塘桥街道\",\"center\":\"121.527,31.2171\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"老港镇\",\"center\":\"121.806,31.0576\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"浦兴路街道\",\"center\":\"121.589,31.287\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"金杨新村街道\",\"center\":\"121.564,31.2698\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"陆家嘴街道\",\"center\":\"121.527,31.2452\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"上钢新村街道\",\"center\":\"121.478,31.1887\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"外高桥保税区\",\"center\":\"121.585,31.3585\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"合庆镇\",\"center\":\"121.719,31.258\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"金桥经济技术开发区\",\"center\":\"121.678,31.2325\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"南汇新城镇\",\"center\":\"121.891,30.9733\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"三林镇\",\"center\":\"121.539,31.1332\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"唐镇\",\"center\":\"121.646,31.2458\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"书院镇\",\"center\":\"121.836,30.9316\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310115\",\"name\":\"高桥镇\",\"center\":\"121.546,31.3594\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"崇明区\",\"center\":\"121.397516,31.626946\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"新海镇\",\"center\":\"121.285,31.7995\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"中兴镇\",\"center\":\"121.752,31.6661\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"新河镇\",\"center\":\"121.529,31.7381\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"新村乡\",\"center\":\"121.266,31.8641\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"港沿镇\",\"center\":\"121.608,31.5927\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"竖新镇\",\"center\":\"121.66,31.6378\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"长兴镇\",\"center\":\"121.58,31.4796\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"绿华镇\",\"center\":\"121.224,31.7886\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"堡镇\",\"center\":\"121.635,31.5737\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"上实现代农业园区\",\"center\":\"122.246,31.419\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"陈家镇\",\"center\":\"121.879,31.5117\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"东平镇\",\"center\":\"121.844,31.5542\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"建设镇\",\"center\":\"121.461,31.6918\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"港西镇\",\"center\":\"121.409,31.7322\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"前卫农场\",\"center\":\"121.749,31.375\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"东平林场\",\"center\":\"121.474,31.6739\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"庙镇\",\"center\":\"121.279,31.6994\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"城桥镇\",\"center\":\"121.42,31.6484\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"向化镇\",\"center\":\"121.752,31.5943\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"三星镇\",\"center\":\"121.222,31.7858\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310151\",\"name\":\"横沙乡\",\"center\":\"122.078,31.3235\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"金山区\",\"center\":\"121.330736,30.724697\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"漕泾镇\",\"center\":\"121.356,30.8283\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"廊下镇\",\"center\":\"121.173,30.8204\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"金山工业区\",\"center\":\"121.315,30.8529\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"张堰镇\",\"center\":\"121.268,30.8197\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"山阳镇\",\"center\":\"121.428,30.6807\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"吕巷镇\",\"center\":\"121.196,30.8149\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"亭林镇\",\"center\":\"121.282,30.8948\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"朱泾镇\",\"center\":\"121.187,30.9164\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"枫泾镇\",\"center\":\"121.109,30.8714\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"石化街道\",\"center\":\"121.377,30.6929\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310116\",\"name\":\"金山卫镇\",\"center\":\"121.277,30.7707\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"奉贤区\",\"center\":\"121.458472,30.912345\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"金海街道\",\"center\":\"121.479,30.9753\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"柘林镇\",\"center\":\"121.408,30.8704\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"南桥镇\",\"center\":\"121.493,30.9934\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"海湾镇\",\"center\":\"121.635,30.8717\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"青村镇\",\"center\":\"121.597,30.948\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"奉城镇\",\"center\":\"121.638,30.9822\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"金汇镇\",\"center\":\"121.578,30.9997\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"庄行镇\",\"center\":\"121.383,30.8736\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"四团镇\",\"center\":\"121.74,30.8904\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"上海海港综合经济开发区\",\"center\":\"121.708,30.9069\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"上海市奉贤区海湾旅游区\",\"center\":\"121.521,30.8585\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"奉浦社区\",\"center\":\"121.446,30.9229\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310120\",\"name\":\"奉浦街道\",\"center\":\"121.476,30.9292\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"宝山区\",\"center\":\"121.489934,31.398896\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"张庙街道\",\"center\":\"121.459,31.3391\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"大场镇\",\"center\":\"121.398,31.3351\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"月浦镇\",\"center\":\"121.384,31.415\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"罗店镇\",\"center\":\"121.377,31.4402\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"宝山城市工业园区\",\"center\":\"121.336,31.3044\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"庙行镇\",\"center\":\"121.409,31.3316\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"友谊路街道\",\"center\":\"121.501,31.3836\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"罗泾镇\",\"center\":\"121.302,31.5017\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"淞南镇\",\"center\":\"121.457,31.3409\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"吴淞街道\",\"center\":\"121.506,31.3786\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"杨行镇\",\"center\":\"121.425,31.4005\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"顾村镇\",\"center\":\"121.374,31.3738\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310113\",\"name\":\"高境镇\",\"center\":\"121.498,31.3375\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"嘉定区\",\"center\":\"121.250333,31.383524\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"新成路街道\",\"center\":\"121.275,31.4013\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"华亭镇\",\"center\":\"121.235,31.4435\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"外冈镇\",\"center\":\"121.173,31.3928\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"嘉定镇街道\",\"center\":\"121.249,31.3931\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"南翔镇\",\"center\":\"121.266,31.3072\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"菊园新区\",\"center\":\"121.203,31.3726\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"马陆镇\",\"center\":\"121.316,31.3981\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"真新街道\",\"center\":\"121.362,31.2391\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"嘉定工业区\",\"center\":\"121.206,31.4089\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"徐行镇\",\"center\":\"121.199,31.3812\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"江桥镇\",\"center\":\"121.253,31.2945\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310114\",\"name\":\"安亭镇\",\"center\":\"121.259,31.3032\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"普陀区\",\"center\":\"121.392499,31.241701\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"万里街道\",\"center\":\"121.406,31.2769\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"长征镇\",\"center\":\"121.376,31.2461\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"真如镇街道\",\"center\":\"121.39,31.2655\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"宜川路街道\",\"center\":\"121.442,31.2641\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"石泉路街道\",\"center\":\"121.418,31.2605\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"长寿路街道\",\"center\":\"121.448,31.2421\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"桃浦镇\",\"center\":\"121.397,31.2898\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"甘泉路街道\",\"center\":\"121.426,31.2717\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"长风新村街道\",\"center\":\"121.4,31.2353\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310107\",\"name\":\"曹杨新村街道\",\"center\":\"121.399,31.243\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"黄浦区\",\"center\":\"121.490317,31.222771\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"豫园街道\",\"center\":\"121.495,31.229\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"淮海中路街道\",\"center\":\"121.479,31.2263\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"小东门街道\",\"center\":\"121.495,31.2244\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"打浦桥街道\",\"center\":\"121.472,31.2108\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"老西门街道\",\"center\":\"121.492,31.2219\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"南京东路街道\",\"center\":\"121.474,31.2413\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"瑞金二路街道\",\"center\":\"121.457,31.2211\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"五里桥街道\",\"center\":\"121.485,31.2068\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"半淞园路街道\",\"center\":\"121.483,31.2088\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310101\",\"name\":\"外滩街道\",\"center\":\"121.496,31.2328\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"杨浦区\",\"center\":\"121.522797,31.270755\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"新江湾城街道\",\"center\":\"121.52,31.3437\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"江浦路街道\",\"center\":\"121.522,31.2732\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"长白新村街道\",\"center\":\"121.543,31.2994\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"大桥街道\",\"center\":\"121.524,31.2709\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"五角场街道\",\"center\":\"121.489,31.3115\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"延吉新村街道\",\"center\":\"121.533,31.2916\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"定海路街道\",\"center\":\"121.558,31.3035\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"平凉路街道\",\"center\":\"121.52,31.2628\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"长海路街道\",\"center\":\"121.528,31.2889\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"控江路街道\",\"center\":\"121.512,31.2851\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"殷行街道\",\"center\":\"121.529,31.3389\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310110\",\"name\":\"四平路街道\",\"center\":\"121.497,31.2847\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"松江区\",\"center\":\"121.223543,31.03047\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"小昆山镇\",\"center\":\"121.086,31.0631\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"佘山镇\",\"center\":\"121.184,31.1207\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"洞泾镇\",\"center\":\"121.256,31.1021\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"岳阳街道\",\"center\":\"121.228,31.0205\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"叶榭镇\",\"center\":\"121.362,30.9428\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"石湖荡镇\",\"center\":\"121.097,30.9669\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"新浜镇\",\"center\":\"121.034,30.9505\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"松江工业区\",\"center\":\"121.334,31.0402\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"永丰街道\",\"center\":\"121.177,31.0038\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"新桥镇\",\"center\":\"121.282,31.072\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"泖港镇\",\"center\":\"121.219,30.9454\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"车墩镇\",\"center\":\"121.294,31.0092\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"中山街道\",\"center\":\"121.242,31.0171\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"泗泾镇\",\"center\":\"121.24,31.1301\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"方松街道\",\"center\":\"121.196,31.0434\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"九里亭街道\",\"center\":\"121.325,31.1422\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"广富林街道\",\"center\":\"121.238,31.0573\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310117\",\"name\":\"九亭镇\",\"center\":\"121.305,31.129\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"静安区\",\"center\":\"121.448224,31.229003\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"石门二路街道\",\"center\":\"121.459,31.2388\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"江宁路街道\",\"center\":\"121.445,31.2406\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"芷江西路街道\",\"center\":\"121.459,31.2603\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"北站街道\",\"center\":\"121.48,31.2527\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"彭浦新村街道\",\"center\":\"121.448,31.317\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"曹家渡街道\",\"center\":\"121.433,31.235\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"大宁路街道\",\"center\":\"121.461,31.2793\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"彭浦镇\",\"center\":\"121.432,31.3059\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"天目西路街道\",\"center\":\"121.46,31.2488\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"静安寺街道\",\"center\":\"121.436,31.2236\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"共和新路街道\",\"center\":\"121.467,31.2717\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"南京西路街道\",\"center\":\"121.468,31.2255\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"临汾路街道\",\"center\":\"121.455,31.3135\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310106\",\"name\":\"宝山路街道\",\"center\":\"121.479,31.26\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"长宁区\",\"center\":\"121.4222,31.218123\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"北新泾街道\",\"center\":\"121.366,31.2259\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"华阳路街道\",\"center\":\"121.423,31.2277\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"新华路街道\",\"center\":\"121.42,31.2089\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"仙霞新村街道\",\"center\":\"121.388,31.2137\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"虹桥街道\",\"center\":\"121.384,31.1923\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"新泾镇\",\"center\":\"121.346,31.2399\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"程家桥街道\",\"center\":\"121.357,31.1874\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"天山路街道\",\"center\":\"121.405,31.214\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"周家桥街道\",\"center\":\"121.385,31.2152\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310105\",\"name\":\"江苏路街道\",\"center\":\"121.435,31.2252\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"虹口区\",\"center\":\"121.491832,31.26097\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"欧阳路街道\",\"center\":\"121.485,31.2678\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"四川北路街道\",\"center\":\"121.481,31.2556\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"北外滩街道\",\"center\":\"121.512,31.2597\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"嘉兴路街道\",\"center\":\"121.494,31.2684\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"江湾镇街道\",\"center\":\"121.478,31.2896\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"曲阳路街道\",\"center\":\"121.501,31.288\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"广中路街道\",\"center\":\"121.463,31.2755\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310109\",\"name\":\"凉城新村街道\",\"center\":\"121.462,31.2798\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"徐汇区\",\"center\":\"121.43752,31.179973\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"枫林路街道\",\"center\":\"121.456,31.2005\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"田林街道\",\"center\":\"121.417,31.192\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"华泾镇\",\"center\":\"121.437,31.1278\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"漕河泾街道\",\"center\":\"121.442,31.1774\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"康健新村街道\",\"center\":\"121.412,31.1644\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"龙华街道\",\"center\":\"121.448,31.1786\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"虹梅路街道\",\"center\":\"121.398,31.1788\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"斜土路街道\",\"center\":\"121.459,31.2021\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"天平路街道\",\"center\":\"121.462,31.2102\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"湖南路街道\",\"center\":\"121.45,31.2165\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"漕河泾新兴技术开发区\",\"center\":\"121.413,31.177\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"徐家汇街道\",\"center\":\"121.426,31.1985\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"凌云路街道\",\"center\":\"121.426,31.1498\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310104\",\"name\":\"长桥街道\",\"center\":\"121.45,31.1536\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"青浦区\",\"center\":\"121.113021,31.151209\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"重固镇\",\"center\":\"121.17,31.2388\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"朱家角镇\",\"center\":\"120.941,31.1217\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"夏阳街道\",\"center\":\"121.106,31.1395\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"金泽镇\",\"center\":\"120.943,31.1179\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"赵巷镇\",\"center\":\"121.183,31.1431\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"练塘镇\",\"center\":\"121.06,31.0543\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"盈浦街道\",\"center\":\"121.068,31.1523\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"香花桥街道\",\"center\":\"121.106,31.2239\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"华新镇\",\"center\":\"121.202,31.2555\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"白鹤镇\",\"center\":\"121.161,31.2393\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310118\",\"name\":\"徐泾镇\",\"center\":\"121.254,31.2019\",\"level\":\"street\",\"districts\":[]}]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"闵行区\",\"center\":\"121.375972,31.111658\",\"level\":\"district\",\"districts\":[{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"虹桥镇\",\"center\":\"121.413,31.1901\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"古美街道\",\"center\":\"121.396,31.1559\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"江川路街道\",\"center\":\"121.359,30.9975\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"莘庄工业区\",\"center\":\"121.392,31.0626\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"马桥镇\",\"center\":\"121.368,31.0058\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"吴泾镇\",\"center\":\"121.455,31.0719\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"梅陇镇\",\"center\":\"121.392,31.1591\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"华漕镇\",\"center\":\"121.267,31.2517\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"颛桥镇\",\"center\":\"121.423,31.0139\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"莘庄镇\",\"center\":\"121.395,31.1287\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"浦锦街道\",\"center\":\"121.477,31.1113\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"七宝镇\",\"center\":\"121.331,31.1677\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"浦江镇\",\"center\":\"121.543,30.9939\",\"level\":\"street\",\"districts\":[]},{\"citycode\":\"021\",\"adcode\":\"310112\",\"name\":\"新虹街道\",\"center\":\"121.312,31.2185\",\"level\":\"street\",\"districts\":[]}]}]}]}]}"))
	data := make(map[string]interface{})
	err = json.Unmarshal(b, &data)
	if err != nil {
		return
	}
	districts := data["districts"].([]interface{})
	recursionAddAreas(db, districts)
}

func recursionAddAreas(db *gorm.DB, areaData []interface{}) {
	length := len(areaData)
	if length == 0 {
		return
	}
	data := make([]*dbobj.Area, 0, length)
	for _, v := range areaData {
		info := v.(map[string]interface{})
		countryArea := &dbobj.Area{
			Adcode:    info["adcode"].(string),
			WholeName: info["name"].(string),
			Level:     info["level"].(string),
		}
		switch info["citycode"].(type) {
		case string:
			countryArea.CityCode = info["citycode"].(string)
		default:
			countryArea.CityCode = ""
		}
		center := strings.Split(info["center"].(string), ",")
		countryArea.SName = countryArea.WholeName
		countryArea.Lon = center[0]
		countryArea.Lat = center[1]
		districts := info["districts"].([]interface{})
		data = append(data, countryArea)
		if countryArea.Level == "country" {
			break
		}
		if len(districts) > 0 {
			recursionAddAreas(db, districts)
		}
	}
	err := AreaBatchSave(db, data)
	if err != nil {
		fmt.Println("recursionAddAreas", err)
	}

}

func AreaBatchSave(db *gorm.DB, emps []*dbobj.Area) error {
	var buffer bytes.Buffer
	sql := "INSERT INTO areas (s_name,area_key,parent_id,level,whole_name,lon,lat,city_code,zip_code,adcode,pin_yin,simple_py,per_pin_yin,path) VALUES "
	if _, err := buffer.WriteString(sql); err != nil {
		return err
	}
	for i, e := range emps {
		if i == len(emps)-1 {
			buffer.WriteString(fmt.Sprintf("('%s','%s',0,'%s','%s','%s','%s','%s','','%s','','','','');",
				e.SName, e.Lon+","+e.Lat+"_"+e.Level, e.Level, e.WholeName, e.Lon, e.Lat, e.CityCode, e.Adcode))
		} else {
			buffer.WriteString(fmt.Sprintf("('%s','%s',0,'%s','%s','%s','%s','%s','','%s','','','',''),",
				e.SName, e.Lon+","+e.Lat+"_"+e.Level, e.Level, e.WholeName, e.Lon, e.Lat, e.CityCode, e.Adcode))
		}
	}
	return db.Exec(buffer.String()).Error
}
